/*
 * Graph.h
 *
 *  Created on: 14 mars 2012
 *      Author: Administrator
 */

#ifndef GRAPH_H_
#define GRAPH_H_

#include "model_engine.h"

#include <QtCore\QtCore>

#include "Arete.h"
#include "Noeud.h"

class Graph {
	/*Atributs*/
private:
	QList<Noeud*> qvector_noeuds;
	QList<Arete*> qvector_aretes;

	/*Fonctions*/
public:
	MODEL_ENGINE_API Graph();
	MODEL_ENGINE_API Graph(const Graph &g1);
	MODEL_ENGINE_API static Graph genererGraphAleatoire(int,int);
	
	MODEL_ENGINE_API void ajouterNoeud(Noeud*);
	MODEL_ENGINE_API void ajouterArete(Arete*);
	MODEL_ENGINE_API bool containsNoeud(Noeud*);
	MODEL_ENGINE_API bool containsArete(Arete*);
	
	MODEL_ENGINE_API QList<Noeud*> voisinageNoeuds(const Noeud&);
	MODEL_ENGINE_API QList<Arete*> voisinageAretes(const Noeud&);
	
	MODEL_ENGINE_API inline int nombreNoeuds() const { return qvector_noeuds.size(); }
	MODEL_ENGINE_API inline int nombreAretes() const { return qvector_aretes.size(); }
	MODEL_ENGINE_API inline QList<Noeud*> noeuds() const { return qvector_noeuds; }
    MODEL_ENGINE_API inline QList<Arete*> aretes() const { return qvector_aretes; }

	MODEL_ENGINE_API friend std::ostream& operator<<( std::ostream &flux, Graph const& a );
};

#endif /* GRAPH_H_ */
